<template>
  <div class="page-miH page-bgBack importsData-box">
    <PageHeader @back="onBack" subTitle="返回" class="PageHeaders">
      {{ current != 3 ? "导入考勤数据" : "处理异常数据" }}
    </PageHeader>
    <div class="steps" v-if="current != 3">
      <a-steps :current="current">
        <a-step v-for="item in steps" :key="item.title" :title="item.title" />
      </a-steps>
    </div>
    <sets v-if="current === 0" @onAction="onAction" />
    <upload v-if="current === 1" :vJson="uploadJson" @onAction="onAction" />
    <preview v-if="current === 2" :vJson="previewJson" @onAction="onAction" @onActionS="onActionS" />
    <abnormal v-if="current === 3" :vJson="previewJson" @onAction="onAction" />
  </div>
</template>
<script>
import sets from "./component/set";
import upload from "./component/upload";
import preview from "./component/preview";
import abnormal from "./component/abnormal";

export default {
  components: {
    sets,
    upload,
    preview,
    abnormal
  },
  data() {
    return {
      current: 0,
      steps: [
        {
          title: "设置导入模版"
        },
        {
          title: "上传并核对考勤表"
        }
      ],
      status: false,
      rdata: "",
      uploadJson: {},
      previewJson: {}
    };
  },
  created() {
    // if (this.$store.state.recruitment.talentPoolTempId) {
    //   this.current = 1;
    //   this.talentPoolTempId = this.$store.state.recruitment.talentPoolTempId;
    // }
  },
  methods: {
    onBack() {
      if (this.current !== 3) {
        this.$router.go(-1);
        this.$store.commit("check/componentName", "imports");
      } else {
        this.current = 2;
      }
    },
    onAction(e, v) {
      this.current = e;
      if (v) {
        this[`${v.type}Json`] = v;
      }
    },
    onActionS(e, status, data) {
      this.current = e;
      this.status = status;
      this.rdata = data;
    }
  }
};
</script>
<style lang="scss" scoped>
::v-deep .PageHeaders .left2 {
  color: #c0c0c0;
  font-size: 14px;
}
::v-deep .PageHeaders .anticon-left {
  color: #c0c0c0;
}
.importsData-box {
  padding-bottom: 24px;
  .steps {
    height: 112px;
    // box-shadow: 0px 4px 12px 0px rgba(106, 102, 246, 0.1);
    background: #fafafa;
    border-radius: 4px;
    margin: 24px;
    padding: 40px 186px;
    box-sizing: border-box;
  }
}
</style>
